<html>
<head><meta charset="utf-8"><title>A SimdIndex type/trait? · project-portable-simd · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/index.html">project-portable-simd</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html">A SimdIndex type/trait?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="240864500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240864500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240864500">(May 31 2021 at 19:23)</a>:</h4>
<p>Do we want to separate out "a vector of indices" as an idea from SimdUsize or our current occasional instances of <code>[u32; N]</code>?</p>



<a name="240866031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240866031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240866031">(May 31 2021 at 19:47)</a>:</h4>
<p>I think it may make sense, particularly if indices have different sizes on various architectures.  It may also make sense to have different index vector types for dynamic shuffle and for scatter/gather</p>



<a name="240866119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240866119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240866119">(May 31 2021 at 19:48)</a>:</h4>
<p>Also, I looked again at LLVM and it's not clear that there's any distinction between dynamic and static shuffles.  They're the same instruction.</p>



<a name="240866201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240866201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240866201">(May 31 2021 at 19:50)</a>:</h4>
<p>(so we may want to attempt to use a single index type for them, and perhaps unify the interface entirely)</p>



<a name="240868499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240868499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240868499">(May 31 2021 at 20:24)</a>:</h4>
<p>i still think it's valuable to have dynamic and static shuffles separated even if llvm unifies them</p>



<a name="240868753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240868753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240868753">(May 31 2021 at 20:28)</a>:</h4>
<p>what Thom said: things that are mere hints to LLVM are still valuable to encode at our type level.</p>



<a name="240869390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240869390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240869390">(May 31 2021 at 20:38)</a>:</h4>
<p>actually, iirc llvm only has static shuffle in its generic IR, dynamic shuffle has to use arch-specific intrinsics</p>



<a name="240869416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240869416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240869416">(May 31 2021 at 20:39)</a>:</h4>
<p>huh, are you sure? I was almost certain shufflevector accepted dynamic arguments.</p>



<a name="240869446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240869446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240869446">(May 31 2021 at 20:39)</a>:</h4>
<blockquote>
<p>The mask vector elements must be constant integers or undef values.</p>
</blockquote>



<a name="240869451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240869451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240869451">(May 31 2021 at 20:39)</a>:</h4>
<p>welp.</p>



<a name="240869519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240869519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240869519">(May 31 2021 at 20:40)</a>:</h4>
<p><a href="https://llvm.org/docs/LangRef.html#shufflevector-instruction">https://llvm.org/docs/LangRef.html#shufflevector-instruction</a></p>



<a name="240874542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240874542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240874542">(May 31 2021 at 21:57)</a>:</h4>
<p><span class="user-mention silent" data-user-id="312331">Caleb Zulawski</span> <a href="#narrow/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F/near/240866031">said</a>:</p>
<blockquote>
<p>I think it may make sense, particularly if indices have different sizes on various architectures.  It may also make sense to have different index vector types for dynamic shuffle and for scatter/gather</p>
</blockquote>
<p>for scatter/gather, aarch64 SVE2 uses 64 bits (which is also usize/isize, Obviously), but zext/sexts from 32 bits<br>
Intel uses up to u32 for shuffles and gathers.<br>
some explicit vectorization libraries for C++ use u32 always.</p>



<a name="240874882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240874882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240874882">(May 31 2021 at 22:03)</a>:</h4>
<p>I am sure the RISCV-V spec does something absolutely wild. Let's see...</p>
<blockquote>
<p>The vrgather.vv form uses SEW/LMUL for both the data and indices. The vrgatherei16.vv form uses SEW/LMUL for the data in vs2 but EEW=16 and EMUL = (16/SEW)*LMUL for the indices in vs1.</p>
<blockquote>
<p>Note<br>
    When SEW=8, vrgather.vv can only reference vector elements 0-255. The vrgatherei16 form can index 64K elements, and can also be used to reduce the register capacity needed to hold indices when SEW &gt; 16. <br>
</p>
</blockquote>
</blockquote>
<p>ah yep.</p>



<a name="240874954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240874954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240874954">(May 31 2021 at 22:04)</a>:</h4>
<p>65535 elements, or whatever the numeric size actually allows.</p>



<a name="240877522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240877522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240877522">(May 31 2021 at 22:52)</a>:</h4>
<p>for gather/scatter, x86 supports both 32 and 64-bit indexes (icr if 32-bit indexes are sign/zero extended when computing addresses)</p>



<a name="240877614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240877614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240877614">(May 31 2021 at 22:54)</a>:</h4>
<p><span class="user-mention silent" data-user-id="229517">Jacob Lifshay</span> <a href="#narrow/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F/near/240877522">said</a>:</p>
<blockquote>
<p>for gather/scatter, x86 supports both 32 and 64-bit indexes (icr if 32-bit indexes are sign/zero extended when computing addresses)</p>
</blockquote>
<p>ah, the instructions I read used 32 bit indices? hm.</p>



<a name="240877616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240877616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240877616">(May 31 2021 at 22:54)</a>:</h4>
<p>they were offset by a 64 bit number, obviously.</p>



<a name="240877681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240877681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240877681">(May 31 2021 at 22:56)</a>:</h4>
<blockquote>
<p>_mm512_i64scatter_ps, _mm512_mask_i64scatter_ps</p>
</blockquote>
<p>ah, well.</p>



<a name="240877974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240877974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240877974">(May 31 2021 at 23:01)</a>:</h4>
<blockquote>
<p>Gathers 2/4 packed single-precision floating point values from memory referenced by the given base address, qword indices and scale. The corresponding Intel® AVX2 instruction is VGATHERQPS</p>
</blockquote>
<p>hmm actually they can use qword indices on AVX2, odd.</p>



<a name="240891032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240891032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240891032">(Jun 01 2021 at 03:27)</a>:</h4>
<blockquote>
<p>error[E0512]: cannot transmute between types of different sizes, or dependently-sized types<br>
  --&gt; crates\core_simd\src\array.rs:46:45<br>
   |<br>
46 |             let ptrs: [*const i32; LANES] = mem::transmute(ptrs);<br>
   |                                             ^^^^^^^^^^^^^^<br>
   |<br>
   = note: source type: <code>uint::SimdUsize&lt;LANES&gt;</code> (size can vary because of [usize; LANES])<br>
   = note: target type: <code>[*const i32; LANES]</code> (this type does not have a fixed size)</p>
</blockquote>
<p>oookay.</p>



<a name="240892155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240892155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240892155">(Jun 01 2021 at 03:53)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#[repr(simd)]</span><span class="w"></span>
<span class="k">struct</span> <span class="nc">ptrx2</span><span class="p">(</span><span class="o">*</span><span class="k">mut</span><span class="w"> </span><span class="kt">i32</span><span class="p">,</span><span class="w"> </span><span class="o">*</span><span class="k">mut</span><span class="w"> </span><span class="kt">i32</span><span class="p">);</span><span class="w"></span>
</code></pre></div>
<blockquote>
<p>error[E0077]: SIMD vector element type should be a primitive scalar (integer/float/pointer) type</p>
</blockquote>
<p>Feel like I'm absolutely losing my mind here.</p>



<a name="240892684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240892684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240892684">(Jun 01 2021 at 04:06)</a>:</h4>
<p>That seems like a compiler bug (or maybe vectors of pointers were explicitly removed for some reason?)</p>



<a name="240892847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240892847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240892847">(Jun 01 2021 at 04:10)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#![feature(repr_simd)]</span><span class="w"></span>

<span class="cp">#[derive(Copy, Clone, Debug)]</span><span class="w"></span>
<span class="cp">#[repr(simd)]</span><span class="w"></span>
<span class="k">pub</span><span class="w"> </span><span class="k">struct</span> <span class="nc">ptrx2</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">T</span><span class="p">);</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">v</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="fm">vec!</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="mi">3</span><span class="p">,</span><span class="w"> </span><span class="mi">4</span><span class="p">];</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ptrx2</span><span class="p">(</span><span class="n">v</span><span class="p">.</span><span class="n">as_ptr</span><span class="p">(),</span><span class="w"> </span><span class="n">v</span><span class="p">.</span><span class="n">as_ptr</span><span class="p">());</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>this is legal? what is rustc smoking.</p>



<a name="240892963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240892963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240892963">(Jun 01 2021 at 04:13)</a>:</h4>
<p>Maybe the error message is wrong?  Maybe it doesn't support pointers?</p>



<a name="240892966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240892966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240892966">(Jun 01 2021 at 04:13)</a>:</h4>
<p>(yet)</p>



<a name="240892975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240892975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240892975">(Jun 01 2021 at 04:14)</a>:</h4>
<p>no, that is me successfully instantiating a double ptr, but it only works when I use generic T as the type.</p>



<a name="240893024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240893024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240893024">(Jun 01 2021 at 04:14)</a>:</h4>
<p>...wait.</p>



<a name="240893087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240893087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240893087">(Jun 01 2021 at 04:16)</a>:</h4>
<blockquote>
<div class="codehilite"><pre><span></span><code>let x = ptrx2(&#39;a&#39;, &#39;a&#39;);
</code></pre></div>

</blockquote>
<p>that _also_ works.<br>
...but chars should be banned..</p>



<a name="240893185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240893185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240893185">(Jun 01 2021 at 04:18)</a>:</h4>
<p>I at least got it to error on strings and Vecs, so the entire world hasn't crumbled yet.</p>



<a name="240893438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240893438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240893438">(Jun 01 2021 at 04:24)</a>:</h4>
<p>but i need Simd&lt;[String; 4]&gt; for perf</p>



<a name="240893566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240893566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240893566">(Jun 01 2021 at 04:26)</a>:</h4>
<p><span class="user-mention silent" data-user-id="209168">Thom Chiovoloni</span> <a href="#narrow/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F/near/240893438">said</a>:</p>
<blockquote>
<p>but i need Simd&lt;[String; 4]&gt; for perf</p>
</blockquote>
<p>HMMMMM</p>



<a name="240893604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240893604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240893604">(Jun 01 2021 at 04:27)</a>:</h4>
<p>I'd hazard a guess that normally it's checking that the type must be a primitive (overly restrictive) and during monomorphization it just checks that it's scalar (overly permitting)</p>



<a name="240893705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240893705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240893705">(Jun 01 2021 at 04:29)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281757">Jubilee</span> <a href="#narrow/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F/near/240893566">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="209168">Thom Chiovoloni</span> <a href="#narrow/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F/near/240893438">said</a>:</p>
<blockquote>
<p>but i need Simd&lt;[String; 4]&gt; for perf</p>
</blockquote>
<p>HMMMMM</p>
</blockquote>
<p>oh no i wasnt serious</p>



<a name="240893766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240893766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240893766">(Jun 01 2021 at 04:30)</a>:</h4>
<p>It's too late Thom, I'm already planning to wedge vectorized strings into Rust somehow. <em>nod</em></p>



<a name="240893803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240893803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Miguel Raz Guzmán Macedo <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240893803">(Jun 01 2021 at 04:31)</a>:</h4>
<p><em>Daniel Lemire has entered the chat</em></p>



<a name="240894919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240894919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240894919">(Jun 01 2021 at 04:56)</a>:</h4>
<p>well, string operations in simd is absolutely a thing we'll support (and already do), it's just... it won't look like a vector of <code>String</code></p>



<a name="240897392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240897392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240897392">(Jun 01 2021 at 05:51)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281757">Jubilee</span> <a href="#narrow/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F/near/240891032">said</a>:</p>
<blockquote>
<blockquote>
<p>error[E0512]: cannot transmute between types of different sizes, or dependently-sized types<br>
  --&gt; crates\core_simd\src\array.rs:46:45<br>
   |<br>
46 |             let ptrs: [*const i32; LANES] = mem::transmute(ptrs);<br>
   |                                             ^^^^^^^^^^^^^^<br>
   |<br>
   = note: source type: <code>uint::SimdUsize&lt;LANES&gt;</code> (size can vary because of [usize; LANES])<br>
   = note: target type: <code>[*const i32; LANES]</code> (this type does not have a fixed size)</p>
</blockquote>
<p>oookay.</p>
</blockquote>
<p>Time for <code>transmute_copy</code>!</p>



<a name="240900183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240900183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240900183">(Jun 01 2021 at 06:39)</a>:</h4>
<p>ran into a wall again.<br>
pretty sure something about ptr-vectors is busted.</p>



<a name="240900199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/240900199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#240900199">(Jun 01 2021 at 06:39)</a>:</h4>
<p>will come back tomorrow.</p>



<a name="241070711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241070711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241070711">(Jun 01 2021 at 20:28)</a>:</h4>
<p>Filed <a href="https://github.com/rust-lang/rust/issues/85915">https://github.com/rust-lang/rust/issues/85915</a></p>



<a name="241074323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241074323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241074323">(Jun 01 2021 at 20:55)</a>:</h4>
<p>And going to continue discussion of debugging that over here, whether or not anyone responds to it. ^^; <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/SIMD.20pointers.20monomorphization.20error.3F/near/241072019">https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/SIMD.20pointers.20monomorphization.20error.3F/near/241072019</a></p>



<a name="241091167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241091167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241091167">(Jun 02 2021 at 00:07)</a>:</h4>
<p>Aaand PR up to fix it in rustc: <a href="https://github.com/rust-lang/rust/pull/85919">https://github.com/rust-lang/rust/pull/85919</a></p>



<a name="241119638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241119638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241119638">(Jun 02 2021 at 08:33)</a>:</h4>
<p>commenting here since GitHub broke:</p>
<blockquote>
<p>Ah, I meant if you could find something that _does_ pass and _doesn't error_... a monomorphization time error (which is currently what happens) is the expected result. It's ugly and undesirable but the status quo, and improving on that is left for later work.</p>
</blockquote>
<p>hmm, maybe raw pointers to external types? can't think of anything else... I added a test case for vector of optional nonnull ptr to extern type... though github doesn't seem to want to update my pull request.<br>
<a href="https://github.com/programmerjake/rust">https://github.com/programmerjake/rust</a> <a href="https://github.com/rust-lang/rust/commit/713b864c5798ea0fdae579d404c21a39d972993b">713b864c5798ea0fdae579d404c21a39d972993b</a><br>
/src/test/ui/simd/simd-type-generic-monomorphisation-extern-nonnull-ptr.rs</p>
<p>github seems seriously broken since it won't let me comment with a link to that commit</p>



<a name="241119738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241119738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241119738">(Jun 02 2021 at 08:34)</a>:</h4>
<p><span class="user-mention" data-user-id="281757">@Jubilee</span> ^</p>



<a name="241119829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241119829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241119829">(Jun 02 2021 at 08:35)</a>:</h4>
<p><a href="https://github.com/programmerjake/rust/blob/713b864c5798ea0fdae579d404c21a39d972993b/src/test/ui/simd/simd-type-generic-monomorphisation-extern-nonnull-ptr.rs">https://github.com/programmerjake/rust/blob/713b864c5798ea0fdae579d404c21a39d972993b/src/test/ui/simd/simd-type-generic-monomorphisation-extern-nonnull-ptr.rs</a></p>



<a name="241309193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241309193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241309193">(Jun 02 2021 at 19:39)</a>:</h4>
<p><span class="user-mention" data-user-id="229517">@Jacob Lifshay</span> I am not sure that a NonNull working is erroneous, these seem to be valid pointer types.</p>



<a name="241312393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241312393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241312393">(Jun 02 2021 at 20:05)</a>:</h4>
<p>I did mean to find MVCEs for <em>issues</em>, not additions to this PR. ^^;</p>



<a name="241312539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241312539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241312539">(Jun 02 2021 at 20:06)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281757">Jubilee</span> <a href="#narrow/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F/near/241309193">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="229517">Jacob Lifshay</span> I am not sure that a NonNull working is erroneous, these seem to be valid pointer types.</p>
</blockquote>
<p>apparently I can't read...I thought you meant add a test case that passes since you didn't like the test case that fails...</p>
<p>I don't have any special insight for things that should fail but are passing, but I do think those test cases are useful to help ensure extern type ptrs with simd aren't broken and that fat ptrs correctly fail.</p>



<a name="241313481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241313481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241313481">(Jun 02 2021 at 20:14)</a>:</h4>
<p>I don't know what the proper behavior for extern ptrs are, and I have already verified that fat ptrs fail monomorphization and I believe there's a test though I don't want to dig through the entire ui directory to find it. That's why I was deliberately conservative.</p>



<a name="241315067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241315067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241315067">(Jun 02 2021 at 20:27)</a>:</h4>
<p>I didn't see a test for fat ptrs...so I added one</p>



<a name="241315159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241315159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241315159">(Jun 02 2021 at 20:28)</a>:</h4>
<p>mm.</p>



<a name="241315243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241315243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241315243">(Jun 02 2021 at 20:29)</a>:</h4>
<p>for extern ptrs, since they're thin, I'd expect them to work</p>



<a name="241320722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241320722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241320722">(Jun 02 2021 at 21:14)</a>:</h4>
<p>welp lol</p>



<a name="241322281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241322281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241322281">(Jun 02 2021 at 21:28)</a>:</h4>
<p><span class="user-mention" data-user-id="229517">@Jacob Lifshay</span> looks like I'll be taking on those tests then. ^^;; lmk if you are done</p>



<a name="241327937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241327937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241327937">(Jun 02 2021 at 22:27)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281757">Jubilee</span> <a href="#narrow/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F/near/241322281">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="229517">Jacob Lifshay</span> looks like I'll be taking on those tests then. ^^;; lmk if you are done</p>
</blockquote>
<p>done, unless something else comes up.</p>



<a name="241329586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241329586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241329586">(Jun 02 2021 at 22:50)</a>:</h4>
<p>thank you!</p>



<a name="241669033"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241669033" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241669033">(Jun 06 2021 at 03:15)</a>:</h4>
<p>Aaand now I have a safe <code>fn gather</code> implementation.</p>



<a name="241701167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241701167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241701167">(Jun 06 2021 at 17:19)</a>:</h4>
<p>And <code>fn scatter</code></p>



<a name="241701701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241701701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241701701">(Jun 06 2021 at 17:32)</a>:</h4>
<p>Safe meaning it uses slice indices? Exciting</p>



<a name="241702780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241702780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241702780">(Jun 06 2021 at 18:01)</a>:</h4>
<p>yep!</p>



<a name="241702786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241702786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241702786">(Jun 06 2021 at 18:01)</a>:</h4>
<p>And it uses the mask to do a bounds check.</p>



<a name="241702927"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241702927" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241702927">(Jun 06 2021 at 18:05)</a>:</h4>
<p>Hmm not sure what you mean but you mentioned that earlier</p>



<a name="241702933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241702933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241702933">(Jun 06 2021 at 18:05)</a>:</h4>
<p>I'll look at the PR when you're done lol</p>



<a name="241703018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/241703018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#241703018">(Jun 06 2021 at 18:07)</a>:</h4>
<p>Oh, so, basically, <code>simd_gather</code> and <code>simd_scatter</code> take masks.<br>
For these safe functions, if an index is not in-bounds, the mask is constructed internally from <code>lanes_lt</code> to bar the read/write, and because of this they don't accept an external mask.</p>



<a name="243454740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/243454740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#243454740">(Jun 21 2021 at 23:08)</a>:</h4>
<p>Speaking of... do we want to standardize on "indices" or "indexes"?</p>



<a name="243454753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/243454753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#243454753">(Jun 21 2021 at 23:09)</a>:</h4>
<p>both are valid, indexes is the North American variant.</p>



<a name="243454982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/243454982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#243454982">(Jun 21 2021 at 23:12)</a>:</h4>
<p>In my experience indices is used for anything technical and indexes more for things like "stock indexes"</p>



<a name="243455016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/243455016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#243455016">(Jun 21 2021 at 23:13)</a>:</h4>
<p>So I vote indices for both the technical usage and probably more universal outside the US?</p>



<a name="243455026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/243455026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#243455026">(Jun 21 2021 at 23:13)</a>:</h4>
<p>Hey, Canada is infected with our usage too. /s</p>



<a name="243455680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/243455680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#243455680">(Jun 21 2021 at 23:22)</a>:</h4>
<p>my experience is that indices is more common in the US too</p>



<a name="243455746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/243455746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#243455746">(Jun 21 2021 at 23:23)</a>:</h4>
<p>going for indices then.</p>



<a name="243463581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/243463581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#243463581">(Jun 22 2021 at 01:35)</a>:</h4>
<p>I prefer indices (and colour) personally 🇨🇦, but Rust docs usually use US spelling.</p>



<a name="243467135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/A%20SimdIndex%20type/trait%3F/near/243467135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/A.20SimdIndex.20type.2Ftrait.3F.html#243467135">(Jun 22 2021 at 02:50)</a>:</h4>
<p>i dont know how to search only docs, but <a href="https://github.com/rust-lang/rust/search?q=indices">https://github.com/rust-lang/rust/search?q=indices</a> vs <a href="https://github.com/rust-lang/rust/search?q=indexes">https://github.com/rust-lang/rust/search?q=indexes</a> shows that the former is overwhelmingly more common</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>